package org.nmgyjt.springboot.controller;

import com.alibaba.fastjson.JSONObject;
import org.nmgyjt.springboot.entity.ApiRes;
import org.nmgyjt.springboot.service.IdaasService;
import org.nmgyjt.springboot.service.OrganizationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("cs/idaas")
public class IdaasController {

    @Autowired
    private IdaasService idaasService;

    @GetMapping("/syncDepartment")
//    @ResponseBody
    public Map syncDepartment(){
        JSONObject depInfo = idaasService.syncDepartment();
        return depInfo;
    }

    @GetMapping("/findUsersByDepId")
//    @ResponseBody
    public ApiRes findUsersByDepId(String depId){
        return ApiRes.ok(idaasService.findUsersByDepId(depId));
    }

    @GetMapping("/findUsersByPhone")
//    @ResponseBody
    public ApiRes findUsersByPhone(String name){
        return ApiRes.ok(idaasService.findUsersByPhone(name));
    }

    @GetMapping("/upZWWXResources")
//    @ResponseBody
    public ApiRes upZWWXResources(String phone){

        return ApiRes.ok(idaasService.upZWWXResources(phone));
    }


}
